#include <bits/stdc++.h>
using namespace std;

pair<int, int> get_num(string s) {
    int a, b;
    string tmp;
    for (int i = 0 ; i < s.size(); ++i) {
        if (s[i] == '/') {
            a = stoi(tmp);
            b = stoi(s.substr(i + 1));
            return {a, b};
        } else tmp += s[i];
    }
}

pair<int, int> func(pair<int, int> fs) {
    int n1 = fs.first, n2 = fs.second;
    return {n1 / __gcd(n1, n2), n2 / __gcd(n1, n2)};
}

int main() {
    int  a1, b1, a2, b2;
    string  num1,  num2;
    cin >> num1 >> num2;
    pair <int, int> tmp;
    tmp = get_num(num1);
    a1=tmp.first;b1=tmp.second;
    tmp = get_num(num2);
    a2=tmp.first;b2=tmp.second;
    int a=a1*a2,b=b1*b2;
    tmp = func({a , b});
    printf("%d %d", tmp.second, tmp.first);
    return 0;
}